package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.RightBean;
import com.lwj.liwanjia.impl.RightView;
import com.lwj.liwanjia.model.RightModel;

import java.util.Map;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/11/1.
 */

public class RightPresenter {
    private RightView rightView;
    private RightModel rightModel;

    public RightPresenter(RightView rightView) {
        this.rightView = rightView;
        rightModel = new RightModel();
    }

    public void getRightData(Map<String, Object> map) {
        if (rightView != null) {
            rightModel.getRightData(map, new Subscriber<RightBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    rightView.showError((Exception) e);
                }

                @Override
                public void onNext(RightBean rightBean) {
                    rightView.getRightData(rightBean);
                }
            });
        }
    }
}
